home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / include / gsl / gsl_message.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-20  |  2.5 KB  |  86 lines

  1. /* err/gsl_message.h
  2.  * 
  3.  * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman, Brian Gough
  4.  * 
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or (at
  8.  * your option) any later version.
  9.  * 
  10.  * This program is distributed in the hope that it will be useful, but
  11.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * General Public License for more details.
  14.  * 
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. #ifndef __GSL_MESSAGE_H__
  21. #define __GSL_MESSAGE_H__
  22.  
  23. #undef __BEGIN_DECLS
  24. #undef __END_DECLS
  25. #ifdef __cplusplus
  26. # define __BEGIN_DECLS extern "C" {
  27. # define __END_DECLS }
  28. #else
  29. # define __BEGIN_DECLS /* empty */
  30. # define __END_DECLS /* empty */
  31. #endif
  32.  
  33. __BEGIN_DECLS
  34.  
  35. /* Provide a general messaging service for client use.  Messages can
  36.  * be selectively turned off at compile time by defining an
  37.  * appropriate message mask. Client code which uses the GSL_MESSAGE()
  38.  * macro must provide a mask which is or'ed with the GSL_MESSAGE_MASK.
  39.  *
  40.  * The messaging service can be completely turned off
  41.  * by defining GSL_MESSAGING_OFF.  */
  42.  
  43. void gsl_message(const char * message, const char * file, int line,
  44.          unsigned int mask);
  45.  
  46. #ifndef GSL_MESSAGE_MASK
  47. #define GSL_MESSAGE_MASK 0xffffffffu /* default all messages allowed */
  48. #endif
  49.  
  50. #ifdef GSL_EXPORTS
  51. __declspec(dllexport) unsigned int gsl_message_mask ;
  52. #elif defined(GSL_IMPORTS)
  53. __declspec(dllimport) unsigned int gsl_message_mask ;
  54. #else
  55. extern unsigned int gsl_message_mask ;
  56. #endif
  57.  
  58. /* Provide some symolic masks for client ease of use. */
  59.  
  60. enum {
  61.   GSL_MESSAGE_MASK_A = 1,
  62.   GSL_MESSAGE_MASK_B = 2,
  63.   GSL_MESSAGE_MASK_C = 4,
  64.   GSL_MESSAGE_MASK_D = 8,
  65.   GSL_MESSAGE_MASK_E = 16,
  66.   GSL_MESSAGE_MASK_F = 32,
  67.   GSL_MESSAGE_MASK_G = 64,
  68.   GSL_MESSAGE_MASK_H = 128
  69. } ;
  70.  
  71. #ifdef GSL_MESSAGING_OFF        /* throw away messages */ 
  72. #define GSL_MESSAGE(message, mask) do { } while(0)
  73. #else                           /* output all messages */
  74. #define GSL_MESSAGE(message, mask) \
  75.        do { \
  76.        if (mask & GSL_MESSAGE_MASK) \
  77.      gsl_message (message, __FILE__, __LINE__, mask) ; \
  78.        } while (0)
  79. #endif
  80.  
  81. __END_DECLS
  82.  
  83. #endif /* __GSL_MESSAGE_H__ */
  84.  
  85.  
  86.